<?php
session_start();
require 'authentication.php';
include('db_con.php');

    $file =  $_FILES["file"]["name"];
    $name = $_POST['name'];
    $price = $_POST['price'];
    $pic_name = $name.$file;
    
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "pic/" . $pic_name);
      
        $query = "INSERT INTO `tractor`( `name`, `price`, `pic_path`) VALUES ('".$name."', '".$price."', '".$pic_name."')";
        $result = mysqli_query($db_con, $query);
        if($result){
            header("Location: index.php");
        }
    
?>